<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Class template scoped_lock</title>
<link rel="stylesheet" href="../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../../interprocess/indexes_reference.html#doxygen.boost_interprocess_header_reference.scoped__lock_8hpp" title="Header &lt;boost/interprocess/sync/scoped_lock.hpp&gt;">
<link rel="prev" href="classboost_1_1interprocess_1_1null__mutex.html" title="Class null_mutex">
<link rel="next" href="classboost_1_1interprocess_1_1sharable__lock.html" title="Class template sharable_lock">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="classboost_1_1interprocess_1_1null__mutex.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../interprocess/indexes_reference.html#doxygen.boost_interprocess_header_reference.scoped__lock_8hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="classboost_1_1interprocess_1_1sharable__lock.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="refentry">
<a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class template scoped_lock</span></h2>
<p>boost::interprocess::scoped_lock</p>
</div>
<h2 class="refsynopsisdiv-title">Synopsis</h2>
<div class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../interprocess/indexes_reference.html#doxygen.boost_interprocess_header_reference.scoped__lock_8hpp" title="Header &lt;boost/interprocess/sync/scoped_lock.hpp&gt;">boost/interprocess/sync/scoped_lock.hpp</a>&gt;

</span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Mutex<span class="special">&gt;</span> 
<span class="keyword">class</span> <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a> <span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
  <span class="comment">// types</span>
  <span class="keyword">typedef</span> <span class="identifier">Mutex</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1aa2a646139667239a04a5798edf0313c9"></a><span class="identifier">mutex_type</span><span class="special">;</span>

  <span class="comment">// <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#id101-bb">public member functions</a></span>
  <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1aee816a4be359f8dd3ac6dbf1a0cb68d2"><span class="identifier">scoped_lock</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
  <span class="keyword">explicit</span> <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a9a026e48b87795491ee6df539e213c83"><span class="identifier">scoped_lock</span></a><span class="special">(</span><span class="identifier">mutex_type</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a4ed8c30faeae19f60b7050e9917238cc"><span class="identifier">scoped_lock</span></a><span class="special">(</span><span class="identifier">mutex_type</span> <span class="special">&amp;</span><span class="special">,</span> <a class="link" href="structboost_1_1interprocess_1_1defer__lock__type.html" title="Struct defer_lock_type">defer_lock_type</a><span class="special">)</span><span class="special">;</span>
  <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a47051dbdf4ffdc5c4beaf98e7a83bf0d"><span class="identifier">scoped_lock</span></a><span class="special">(</span><span class="identifier">mutex_type</span> <span class="special">&amp;</span><span class="special">,</span> <a class="link" href="structboost_1_1interprocess_1_1accept__ownership__type.html" title="Struct accept_ownership_type">accept_ownership_type</a><span class="special">)</span><span class="special">;</span>
  <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a6149fa1f8a668b17e2db09e22af111a8"><span class="identifier">scoped_lock</span></a><span class="special">(</span><span class="identifier">mutex_type</span> <span class="special">&amp;</span><span class="special">,</span> <a class="link" href="structboost_1_1interprocess_1_1try__to__lock__type.html" title="Struct try_to_lock_type">try_to_lock_type</a><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> TimePoint<span class="special">&gt;</span> <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1affcdc1a7815195ec5cab136754f5264b"><span class="identifier">scoped_lock</span></a><span class="special">(</span><span class="identifier">mutex_type</span> <span class="special">&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">TimePoint</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a06d57957b67c00e7d35b6605cccf8cc0"><span class="identifier">scoped_lock</span></a><span class="special">(</span><a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a> <span class="special">&amp;&amp;</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
    <span class="keyword">explicit</span> <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ade26ec80defd4d968d199b15ad15e979"><span class="identifier">scoped_lock</span></a><span class="special">(</span><a class="link" href="classboost_1_1interprocess_1_1upgradable__lock.html" title="Class template upgradable_lock">upgradable_lock</a><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span> <span class="special">&amp;&amp;</span><span class="special">,</span> <span class="emphasis"><em><span class="identifier">unspecified</span></em></span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
    <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a7ab15ac0ca04abf17dd10d782d53d7b4"><span class="identifier">scoped_lock</span></a><span class="special">(</span><a class="link" href="classboost_1_1interprocess_1_1upgradable__lock.html" title="Class template upgradable_lock">upgradable_lock</a><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span> <span class="special">&amp;&amp;</span><span class="special">,</span> <a class="link" href="structboost_1_1interprocess_1_1try__to__lock__type.html" title="Struct try_to_lock_type">try_to_lock_type</a><span class="special">,</span> <span class="emphasis"><em><span class="identifier">unspecified</span></em></span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">typename</span> TimePoint<span class="special">&gt;</span> 
    <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a8aac8210bae7ca7c61539c7d31bdb01c"><span class="identifier">scoped_lock</span></a><span class="special">(</span><a class="link" href="classboost_1_1interprocess_1_1upgradable__lock.html" title="Class template upgradable_lock">upgradable_lock</a><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span> <span class="special">&amp;&amp;</span><span class="special">,</span> <span class="keyword">const</span> <span class="identifier">TimePoint</span> <span class="special">&amp;</span><span class="special">,</span> <span class="emphasis"><em><span class="identifier">unspecified</span></em></span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
    <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad188d9e6136c3fd9cd97033f3771b0fa"><span class="identifier">scoped_lock</span></a><span class="special">(</span><a class="link" href="classboost_1_1interprocess_1_1sharable__lock.html" title="Class template sharable_lock">sharable_lock</a><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span> <span class="special">&amp;&amp;</span><span class="special">,</span> <a class="link" href="structboost_1_1interprocess_1_1try__to__lock__type.html" title="Struct try_to_lock_type">try_to_lock_type</a><span class="special">,</span> <span class="emphasis"><em><span class="identifier">unspecified</span></em></span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad8084319f3f5584df6832db82a044c5b"><span class="special">~</span><span class="identifier">scoped_lock</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a> <span class="special">&amp;</span> <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ab7ba1ab407a85af9893c214f851a8fa9"><span class="keyword">operator</span><span class="special">=</span></a><span class="special">(</span><a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a> <span class="special">&amp;&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a62b75774a9f359053592e0cf5ac84360"><span class="identifier">lock</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">bool</span> <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a6375c2ecbbcf3881ee858b85c65f1fd3"><span class="identifier">try_lock</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> TimePoint<span class="special">&gt;</span> <span class="keyword">bool</span> <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a6e37625230e5ec4d47376f69aa535af1"><span class="identifier">timed_lock</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">TimePoint</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> TimePoint<span class="special">&gt;</span> <span class="keyword">bool</span> <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a1412165b782e1d12db4f721c5a50acbe"><span class="identifier">try_lock_until</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">TimePoint</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Duration<span class="special">&gt;</span> <span class="keyword">bool</span> <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1aff137f659ad1a7bd7cffa43fca39fda2"><span class="identifier">try_lock_for</span></a><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Duration</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a95226de39521b0dfbfdf5f6913f1ac30"><span class="identifier">unlock</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
  <span class="keyword">bool</span> <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad449978166ee8a5b75bd90eadf26aaf2"><span class="identifier">owns</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
  <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ae541a361d9a1bb495e3df173f3d73365"><span class="keyword">operator</span> <span class="identifier">unspecified_bool_type</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
  <span class="identifier">mutex_type</span> <span class="special">*</span> <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1add4cef7e824de9f2d243b6864d967cc1"><span class="identifier">mutex</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
  <span class="identifier">mutex_type</span> <span class="special">*</span> <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a2b9a3f897a0f35eba20a0481dfd2a6c6"><span class="identifier">release</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
  <span class="keyword">void</span> <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a699bba79ce251c921b885d2aea9751c0"><span class="identifier">swap</span></a><span class="special">(</span><a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a><span class="special">&lt;</span> <span class="identifier">mutex_type</span> <span class="special">&gt;</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
<span class="special">}</span><span class="special">;</span></pre></div>
<div class="refsect1">
<a name="id-1.3.16.19.3.75.4.4"></a><h2>Description</h2>
<p><a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a> is meant to carry out the tasks for locking, unlocking, try-locking and timed-locking (recursive or not) for the Mutex. The Mutex need not supply all of this functionality. If the client of scoped_lock&lt;Mutex&gt; does not use functionality which the Mutex does not supply, no harm is done. Mutex ownership transfer is supported through the syntax of move semantics. Ownership transfer is allowed both by construction and assignment. The <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a> does not support copy semantics. A compile time error results if copy construction or copy assignment is attempted. Mutex ownership can also be moved from an <a class="link" href="classboost_1_1interprocess_1_1upgradable__lock.html" title="Class template upgradable_lock">upgradable_lock</a> and <a class="link" href="classboost_1_1interprocess_1_1sharable__lock.html" title="Class template sharable_lock">sharable_lock</a> via constructor. In this role, <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a> shares the same functionality as a write_lock. </p>
<div class="refsect2">
<a name="id-1.3.16.19.3.75.4.4.3"></a><h3>
<a name="id101-bb"></a><code class="computeroutput">scoped_lock</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1aee816a4be359f8dd3ac6dbf1a0cb68d2"></a><span class="identifier">scoped_lock</span><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>Effects: Default constructs a <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a>. Postconditions: <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad449978166ee8a5b75bd90eadf26aaf2">owns()</a> == false and <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1add4cef7e824de9f2d243b6864d967cc1">mutex()</a> == 0. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">explicit</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a9a026e48b87795491ee6df539e213c83"></a><span class="identifier">scoped_lock</span><span class="special">(</span><span class="identifier">mutex_type</span> <span class="special">&amp;</span> m<span class="special">)</span><span class="special">;</span></pre>
<p>Effects: m.lock(). Postconditions: <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad449978166ee8a5b75bd90eadf26aaf2">owns()</a> == true and <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1add4cef7e824de9f2d243b6864d967cc1">mutex()</a> == &amp;m. Notes: The constructor will take ownership of the mutex. If another thread already owns the mutex, this thread will block until the mutex is released. Whether or not this constructor handles recursive locking depends upon the mutex. </p>
</li>
<li class="listitem">
<pre class="literallayout"><a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a4ed8c30faeae19f60b7050e9917238cc"></a><span class="identifier">scoped_lock</span><span class="special">(</span><span class="identifier">mutex_type</span> <span class="special">&amp;</span> m<span class="special">,</span> <a class="link" href="structboost_1_1interprocess_1_1defer__lock__type.html" title="Struct defer_lock_type">defer_lock_type</a><span class="special">)</span><span class="special">;</span></pre>
<p>Postconditions: <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad449978166ee8a5b75bd90eadf26aaf2">owns()</a> == false, and <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1add4cef7e824de9f2d243b6864d967cc1">mutex()</a> == &amp;m. Notes: The constructor will not take ownership of the mutex. There is no effect required on the referenced mutex. </p>
</li>
<li class="listitem">
<pre class="literallayout"><a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a47051dbdf4ffdc5c4beaf98e7a83bf0d"></a><span class="identifier">scoped_lock</span><span class="special">(</span><span class="identifier">mutex_type</span> <span class="special">&amp;</span> m<span class="special">,</span> <a class="link" href="structboost_1_1interprocess_1_1accept__ownership__type.html" title="Struct accept_ownership_type">accept_ownership_type</a><span class="special">)</span><span class="special">;</span></pre>
<p>Postconditions: <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad449978166ee8a5b75bd90eadf26aaf2">owns()</a> == true, and <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1add4cef7e824de9f2d243b6864d967cc1">mutex()</a> == &amp;m. Notes: The constructor will suppose that the mutex is already locked. There is no effect required on the referenced mutex. </p>
</li>
<li class="listitem">
<pre class="literallayout"><a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a6149fa1f8a668b17e2db09e22af111a8"></a><span class="identifier">scoped_lock</span><span class="special">(</span><span class="identifier">mutex_type</span> <span class="special">&amp;</span> m<span class="special">,</span> <a class="link" href="structboost_1_1interprocess_1_1try__to__lock__type.html" title="Struct try_to_lock_type">try_to_lock_type</a><span class="special">)</span><span class="special">;</span></pre>
<p>Effects: m.try_lock(). Postconditions: <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1add4cef7e824de9f2d243b6864d967cc1">mutex()</a> == &amp;m. <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad449978166ee8a5b75bd90eadf26aaf2">owns()</a> == the return value of the m.try_lock() executed within the constructor. Notes: The constructor will take ownership of the mutex if it can do so without waiting. Whether or not this constructor handles recursive locking depends upon the mutex. If the mutex_type does not support try_lock, this constructor will fail at compile time if instantiated, but otherwise have no effect. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> TimePoint<span class="special">&gt;</span> 
  <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1affcdc1a7815195ec5cab136754f5264b"></a><span class="identifier">scoped_lock</span><span class="special">(</span><span class="identifier">mutex_type</span> <span class="special">&amp;</span> m<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">TimePoint</span> <span class="special">&amp;</span> abs_time<span class="special">)</span><span class="special">;</span></pre>
<p>Effects: m.timed_lock(abs_time). Postconditions: <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1add4cef7e824de9f2d243b6864d967cc1">mutex()</a> == &amp;m. <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad449978166ee8a5b75bd90eadf26aaf2">owns()</a> == the return value of the m.timed_lock(abs_time) executed within the constructor. Notes: The constructor will take ownership of the mutex if it can do it until abs_time is reached. Whether or not this constructor handles recursive locking depends upon the mutex. If the mutex_type does not support try_lock, this constructor will fail at compile time if instantiated, but otherwise have no effect. </p>
</li>
<li class="listitem">
<pre class="literallayout"><a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a06d57957b67c00e7d35b6605cccf8cc0"></a><span class="identifier">scoped_lock</span><span class="special">(</span><a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a> <span class="special">&amp;&amp;</span> scop<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>Postconditions: <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1add4cef7e824de9f2d243b6864d967cc1">mutex()</a> == the value scop.mutex() had before the constructor executes. s1.mutex() == 0. <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad449978166ee8a5b75bd90eadf26aaf2">owns()</a> == the value of scop.owns() before the constructor executes. scop.owns(). Notes: If the scop <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a> owns the mutex, ownership is moved to thisscoped_lock with no blocking. If the scop <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a> does not own the mutex, then neither will this <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a>. Only a moved <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a>'s will match this signature. An non-moved <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a> can be moved with the expression: "boost::move(lock);". This constructor does not alter the state of the mutex, only potentially who owns it. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
  <span class="keyword">explicit</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ade26ec80defd4d968d199b15ad15e979"></a><span class="identifier">scoped_lock</span><span class="special">(</span><a class="link" href="classboost_1_1interprocess_1_1upgradable__lock.html" title="Class template upgradable_lock">upgradable_lock</a><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span> <span class="special">&amp;&amp;</span> upgr<span class="special">,</span> <span class="emphasis"><em><span class="identifier">unspecified</span></em></span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="special">;</span></pre>
<p>Effects: If upgr.owns() then calls unlock_upgradable_and_lock() on the referenced mutex. upgr.release() is called. Postconditions: <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1add4cef7e824de9f2d243b6864d967cc1">mutex()</a> == the value upgr.mutex() had before the construction. upgr.mutex() == 0. <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad449978166ee8a5b75bd90eadf26aaf2">owns()</a> == upgr.owns() before the construction. upgr.owns() == false after the construction. Notes: If upgr is locked, this constructor will lock this <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a> while unlocking upgr. If upgr is unlocked, then this <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a> will be unlocked as well. Only a moved <a class="link" href="classboost_1_1interprocess_1_1upgradable__lock.html" title="Class template upgradable_lock">upgradable_lock</a>'s will match this signature. An non-moved <a class="link" href="classboost_1_1interprocess_1_1upgradable__lock.html" title="Class template upgradable_lock">upgradable_lock</a> can be moved with the expression: "boost::move(lock);" This constructor may block if other threads hold a <a class="link" href="classboost_1_1interprocess_1_1sharable__lock.html" title="Class template sharable_lock">sharable_lock</a> on this mutex (<a class="link" href="classboost_1_1interprocess_1_1sharable__lock.html" title="Class template sharable_lock">sharable_lock</a>'s can share ownership with an <a class="link" href="classboost_1_1interprocess_1_1upgradable__lock.html" title="Class template upgradable_lock">upgradable_lock</a>). </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
  <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a7ab15ac0ca04abf17dd10d782d53d7b4"></a><span class="identifier">scoped_lock</span><span class="special">(</span><a class="link" href="classboost_1_1interprocess_1_1upgradable__lock.html" title="Class template upgradable_lock">upgradable_lock</a><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span> <span class="special">&amp;&amp;</span> upgr<span class="special">,</span> <a class="link" href="structboost_1_1interprocess_1_1try__to__lock__type.html" title="Struct try_to_lock_type">try_to_lock_type</a><span class="special">,</span> <span class="emphasis"><em><span class="identifier">unspecified</span></em></span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="special">;</span></pre>
<p>Effects: If upgr.owns() then calls try_unlock_upgradable_and_lock() on the referenced mutex: a)if try_unlock_upgradable_and_lock() returns true then <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1add4cef7e824de9f2d243b6864d967cc1">mutex()</a> obtains the value from upgr.release() and <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad449978166ee8a5b75bd90eadf26aaf2">owns()</a> is set to true. b)if try_unlock_upgradable_and_lock() returns false then upgr is unaffected and this <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a> construction as the same effects as a default construction. c)Else upgr.owns() is false. <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1add4cef7e824de9f2d243b6864d967cc1">mutex()</a> obtains the value from upgr.release() and <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad449978166ee8a5b75bd90eadf26aaf2">owns()</a> is set to false Notes: This construction will not block. It will try to obtain mutex ownership from upgr immediately, while changing the lock type from a "read lock" to a "write lock". If the "read lock" isn't held in the first place, the mutex merely changes type to an unlocked "write lock". If the "read lock" is held, then mutex transfer occurs only if it can do so in a non-blocking manner. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">typename</span> TimePoint<span class="special">&gt;</span> 
  <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a8aac8210bae7ca7c61539c7d31bdb01c"></a><span class="identifier">scoped_lock</span><span class="special">(</span><a class="link" href="classboost_1_1interprocess_1_1upgradable__lock.html" title="Class template upgradable_lock">upgradable_lock</a><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span> <span class="special">&amp;&amp;</span> upgr<span class="special">,</span> <span class="keyword">const</span> <span class="identifier">TimePoint</span> <span class="special">&amp;</span> abs_time<span class="special">,</span> 
              <span class="emphasis"><em><span class="identifier">unspecified</span></em></span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="special">;</span></pre>
<p>Effects: If upgr.owns() then calls timed_unlock_upgradable_and_lock(abs_time) on the referenced mutex: a)if timed_unlock_upgradable_and_lock(abs_time) returns true then <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1add4cef7e824de9f2d243b6864d967cc1">mutex()</a> obtains the value from upgr.release() and <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad449978166ee8a5b75bd90eadf26aaf2">owns()</a> is set to true. b)if timed_unlock_upgradable_and_lock(abs_time) returns false then upgr is unaffected and this <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a> construction as the same effects as a default construction. c)Else upgr.owns() is false. <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1add4cef7e824de9f2d243b6864d967cc1">mutex()</a> obtains the value from upgr.release() and <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad449978166ee8a5b75bd90eadf26aaf2">owns()</a> is set to false Notes: This construction will not block. It will try to obtain mutex ownership from upgr immediately, while changing the lock type from a "read lock" to a "write lock". If the "read lock" isn't held in the first place, the mutex merely changes type to an unlocked "write lock". If the "read lock" is held, then mutex transfer occurs only if it can do so in a non-blocking manner. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
  <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad188d9e6136c3fd9cd97033f3771b0fa"></a><span class="identifier">scoped_lock</span><span class="special">(</span><a class="link" href="classboost_1_1interprocess_1_1sharable__lock.html" title="Class template sharable_lock">sharable_lock</a><span class="special">&lt;</span> <span class="identifier">T</span> <span class="special">&gt;</span> <span class="special">&amp;&amp;</span> shar<span class="special">,</span> <a class="link" href="structboost_1_1interprocess_1_1try__to__lock__type.html" title="Struct try_to_lock_type">try_to_lock_type</a><span class="special">,</span> <span class="emphasis"><em><span class="identifier">unspecified</span></em></span> <span class="special">=</span> <span class="number">0</span><span class="special">)</span><span class="special">;</span></pre>
<p>Effects: If shar.owns() then calls try_unlock_sharable_and_lock() on the referenced mutex. a)if try_unlock_sharable_and_lock() returns true then <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1add4cef7e824de9f2d243b6864d967cc1">mutex()</a> obtains the value from shar.release() and <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad449978166ee8a5b75bd90eadf26aaf2">owns()</a> is set to true. b)if try_unlock_sharable_and_lock() returns false then shar is unaffected and this <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a> construction has the same effects as a default construction. c)Else shar.owns() is false. <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1add4cef7e824de9f2d243b6864d967cc1">mutex()</a> obtains the value from shar.release() and <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad449978166ee8a5b75bd90eadf26aaf2">owns()</a> is set to false Notes: This construction will not block. It will try to obtain mutex ownership from shar immediately, while changing the lock type from a "read lock" to a "write lock". If the "read lock" isn't held in the first place, the mutex merely changes type to an unlocked "write lock". If the "read lock" is held, then mutex transfer occurs only if it can do so in a non-blocking manner. </p>
</li>
<li class="listitem">
<pre class="literallayout"><a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad8084319f3f5584df6832db82a044c5b"></a><span class="special">~</span><span class="identifier">scoped_lock</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Effects: if (<a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad449978166ee8a5b75bd90eadf26aaf2">owns()</a>) mp_mutex-&gt;<a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a95226de39521b0dfbfdf5f6913f1ac30">unlock()</a>. Notes: The destructor behavior ensures that the mutex lock is not leaked.*<span style="color: red">&lt;zwj&gt;&lt;/zwj&gt;</span>/ </p>
</li>
<li class="listitem">
<pre class="literallayout"><a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a> <span class="special">&amp;</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ab7ba1ab407a85af9893c214f851a8fa9"></a><span class="keyword">operator</span><span class="special">=</span><span class="special">(</span><a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a> <span class="special">&amp;&amp;</span> scop<span class="special">)</span><span class="special">;</span></pre>
<p>Effects: If <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad449978166ee8a5b75bd90eadf26aaf2">owns()</a> before the call, then <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a95226de39521b0dfbfdf5f6913f1ac30">unlock()</a> is called on <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1add4cef7e824de9f2d243b6864d967cc1">mutex()</a>. *this gets the state of scop and scop gets set to a default constructed state. Notes: With a recursive mutex it is possible that both this and scop own the same mutex before the assignment. In this case, this will own the mutex after the assignment (and scop will not), but the mutex's lock count will be decremented by one. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a62b75774a9f359053592e0cf5ac84360"></a><span class="identifier">lock</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Effects: If <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1add4cef7e824de9f2d243b6864d967cc1">mutex()</a> == 0 or if already locked, throws a lock_exception() exception. Calls <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a62b75774a9f359053592e0cf5ac84360">lock()</a> on the referenced mutex. Postconditions: <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad449978166ee8a5b75bd90eadf26aaf2">owns()</a> == true. Notes: The <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a> changes from a state of not owning the mutex, to owning the mutex, blocking if necessary. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">bool</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a6375c2ecbbcf3881ee858b85c65f1fd3"></a><span class="identifier">try_lock</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Effects: If <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1add4cef7e824de9f2d243b6864d967cc1">mutex()</a> == 0 or if already locked, throws a lock_exception() exception. Calls <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a6375c2ecbbcf3881ee858b85c65f1fd3">try_lock()</a> on the referenced mutex. Postconditions: <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad449978166ee8a5b75bd90eadf26aaf2">owns()</a> == the value returned from <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1add4cef7e824de9f2d243b6864d967cc1">mutex()</a>-&gt;<a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a6375c2ecbbcf3881ee858b85c65f1fd3">try_lock()</a>. Notes: The <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a> changes from a state of not owning the mutex, to owning the mutex, but only if blocking was not required. If the mutex_type does not support <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a6375c2ecbbcf3881ee858b85c65f1fd3">try_lock()</a>, this function will fail at compile time if instantiated, but otherwise have no effect.*<span style="color: red">&lt;zwj&gt;&lt;/zwj&gt;</span>/ </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> TimePoint<span class="special">&gt;</span> <span class="keyword">bool</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a6e37625230e5ec4d47376f69aa535af1"></a><span class="identifier">timed_lock</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">TimePoint</span> <span class="special">&amp;</span> abs_time<span class="special">)</span><span class="special">;</span></pre>
<p>Effects: If <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1add4cef7e824de9f2d243b6864d967cc1">mutex()</a> == 0 or if already locked, throws a lock_exception() exception. Calls timed_lock(abs_time) on the referenced mutex. Postconditions: <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad449978166ee8a5b75bd90eadf26aaf2">owns()</a> == the value returned from <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1add4cef7e824de9f2d243b6864d967cc1">mutex()</a>-&gt; timed_lock(abs_time). Notes: The <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a> changes from a state of not owning the mutex, to owning the mutex, but only if it can obtain ownership by the specified time. If the mutex_type does not support timed_lock (), this function will fail at compile time if instantiated, but otherwise have no effect.*<span style="color: red">&lt;zwj&gt;&lt;/zwj&gt;</span>/ </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> TimePoint<span class="special">&gt;</span> <span class="keyword">bool</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a1412165b782e1d12db4f721c5a50acbe"></a><span class="identifier">try_lock_until</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">TimePoint</span> <span class="special">&amp;</span> abs_time<span class="special">)</span><span class="special">;</span></pre>
<p>Effects: If <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1add4cef7e824de9f2d243b6864d967cc1">mutex()</a> == 0 or if already locked, throws a lock_exception() exception. Calls try_lock_until(abs_time) on the referenced mutex. Postconditions: <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad449978166ee8a5b75bd90eadf26aaf2">owns()</a> == the value returned from <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1add4cef7e824de9f2d243b6864d967cc1">mutex()</a>-&gt; timed_lock(abs_time). Notes: The <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a> changes from a state of not owning the mutex, to owning the mutex, but only if it can obtain ownership by the specified time. If the mutex_type does not support timed_lock (), this function will fail at compile time if instantiated, but otherwise have no effect.*<span style="color: red">&lt;zwj&gt;&lt;/zwj&gt;</span>/ </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> Duration<span class="special">&gt;</span> <span class="keyword">bool</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1aff137f659ad1a7bd7cffa43fca39fda2"></a><span class="identifier">try_lock_for</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">Duration</span> <span class="special">&amp;</span> dur<span class="special">)</span><span class="special">;</span></pre>
<p>Effects: If <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1add4cef7e824de9f2d243b6864d967cc1">mutex()</a> == 0 or if already locked, throws a lock_exception() exception. Calls try_lock_until(abs_time) on the referenced mutex. Postconditions: <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad449978166ee8a5b75bd90eadf26aaf2">owns()</a> == the value returned from <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1add4cef7e824de9f2d243b6864d967cc1">mutex()</a>-&gt; timed_lock(abs_time). Notes: The <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a> changes from a state of not owning the mutex, to owning the mutex, but only if it can obtain ownership by the specified time. If the mutex_type does not support timed_lock (), this function will fail at compile time if instantiated, but otherwise have no effect.*<span style="color: red">&lt;zwj&gt;&lt;/zwj&gt;</span>/ </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a95226de39521b0dfbfdf5f6913f1ac30"></a><span class="identifier">unlock</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
<p>Effects: If <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1add4cef7e824de9f2d243b6864d967cc1">mutex()</a> == 0 or if not locked, throws a lock_exception() exception. Calls <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a95226de39521b0dfbfdf5f6913f1ac30">unlock()</a> on the referenced mutex. Postconditions: <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad449978166ee8a5b75bd90eadf26aaf2">owns()</a> == false. Notes: The <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a> changes from a state of owning the mutex, to not owning the mutex.*<span style="color: red">&lt;zwj&gt;&lt;/zwj&gt;</span>/ </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">bool</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad449978166ee8a5b75bd90eadf26aaf2"></a><span class="identifier">owns</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>Effects: Returns true if this <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a> has acquired the referenced mutex. </p>
</li>
<li class="listitem">
<pre class="literallayout"><a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ae541a361d9a1bb495e3df173f3d73365"></a><span class="keyword">operator</span> <span class="identifier">unspecified_bool_type</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>Conversion to bool. Returns <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad449978166ee8a5b75bd90eadf26aaf2">owns()</a>. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">mutex_type</span> <span class="special">*</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1add4cef7e824de9f2d243b6864d967cc1"></a><span class="identifier">mutex</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>Effects: Returns a pointer to the referenced mutex, or 0 if there is no mutex to reference. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="identifier">mutex_type</span> <span class="special">*</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a2b9a3f897a0f35eba20a0481dfd2a6c6"></a><span class="identifier">release</span><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>Effects: Returns a pointer to the referenced mutex, or 0 if there is no mutex to reference. Postconditions: <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1add4cef7e824de9f2d243b6864d967cc1">mutex()</a> == 0 and <a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html#doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1ad449978166ee8a5b75bd90eadf26aaf2">owns()</a> == false. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="keyword">void</span> <a name="doxygen.boost_interprocess_header_reference.classboost_1_1interprocess_1_1scoped__lock_1a699bba79ce251c921b885d2aea9751c0"></a><span class="identifier">swap</span><span class="special">(</span><a class="link" href="classboost_1_1interprocess_1_1scoped__lock.html" title="Class template scoped_lock">scoped_lock</a><span class="special">&lt;</span> <span class="identifier">mutex_type</span> <span class="special">&gt;</span> <span class="special">&amp;</span> other<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
<p>Effects: Swaps state with moved lock. Throws: Nothing. </p>
</li>
</ol></div>
</div>
</div>
</div>
<div class="copyright-footer">Copyright © 2005-2024 Ion Gaztanaga<p>
        Distributed under the Boost Software License, Version 1.0. (See accompanying
        file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
      </p>
</div>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="classboost_1_1interprocess_1_1null__mutex.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../interprocess/indexes_reference.html#doxygen.boost_interprocess_header_reference.scoped__lock_8hpp"><img src="../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="classboost_1_1interprocess_1_1sharable__lock.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>
